
# 面向对象设计
def dog(name, gender, type):
    def shout(dog):
        print("一条狗[%s],旺旺" % dog['name'])

    def eat(dog):
        print('一条狗[%s]正在吃' % dog['type'])

    def init(name, gender, type):
        dog = {
            'name': name,
            'gender': gender,
            'type': type,
            'shout': shout,
            'eat': eat,
        }
        return dog

    return init(name, gender, type)

# d1作为一个对象
d1 = dog("哈士奇", "母", "中华田园犬")
print(d1)
d1['shout'](d1)           